﻿using System;
using System.IO;
using System.Security.Cryptography;

namespace Coding4Fun.BoxingBots.Robot.Helpers
{
	public static class FileHelper
	{
		public static string GetMD5Hash(string fileName)
		{
			using(var file = new FileStream(fileName, FileMode.Open))
			{
				MD5 md5 = new MD5CryptoServiceProvider();
				//var retVal = md5.ComputeHash(file);

				return BitConverter.ToString(md5.ComputeHash(file));
			}

			//StringBuilder sb = new StringBuilder();
			//for (int i = 0; i < retVal.Length; i++)
			//{
			//    sb.Append(retVal[i].ToString("x2"));
			//}
			//return sb.ToString();
		}
	}
}
